package cn.inno.entitys;

public class ErrorMsg {

    /**
     * 调用成功
     */
    public static final String CALL_OK = "1";
    /**
     * 调用失败
     */
    public static final String CALL_FAIL = "-1";

    /**
     * 错误代码的key
     */
    public static final String KEY_CODE = "code";
    /**
     * 错误消息key
     */
    public static final String KEY_MESSAGE = "message";

    public static final String MESSAGE_OK = "调用成功";
    public static final String MESSAGE_ERROR = "服务器异常";
    public static final String MESSAGE_NOT = "暂无数据";

    private String code;
    private String message;

    public ErrorMsg(String code,String message) {
        this.code = code;
        this.message = message;
    }
    public ErrorMsg(String message) {
        this("unknown", message);
    }

    public ErrorMsg(ErrorMsg errorMsg,String message) {
        if (errorMsg != null) {
            this.code = errorMsg.getCode();
            this.message = errorMsg.getMessage();
        }
        if(message != null){
            this.message = (this.message==null?"":this.message) +" "+ message;
        }
    }

    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }

}